#ifndef ARCHTYPEMODEL_H
#define ARCHTYPEMODEL_H

#include <QAbstractTableModel>
#include <QtGui>

#include "aed_archtype.h"
#include <QTextStream>

using namespace std;

class ArchtypeModel : public QAbstractTableModel
{
    Q_OBJECT

    QVector<AED_Archtype*> m_archs;
public:
    explicit ArchtypeModel(QObject *parent = 0);

    int rowCount(const QModelIndex & parent = QModelIndex()) const;
    int columnCount(const QModelIndex & parent = QModelIndex()) const;
    QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
    QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;


    int AddArchtype(const QString &name);
    void CopyArchtype(const AED_Archtype *arch);
    //void UpdateArchtype(const AED_Archtype &arch, int index);
    void EraseArchtype(int index);
    void Clean();
    AED_Archtype* GetArchtype(int index);
    AED_Archtype* GetArchtype(QString &name);
    QVector<AED_Archtype*>* GetArchtypes(){return &m_archs;}
    void Save(QTextStream &file);
    void Save(QDomDocument &doc, QDomElement &header);
    int FindArchtype(AED_Archtype *arch);
    bool Load(QDomElement &header, ImageManager &imgmngr, ScriptModel &scrmdl);
signals:
    void erased();
public slots:

};

#endif // ARCHTYPEMODEL_H
